package com.csjbot.weedle_auto.fragment.bean

import com.csjbot.weedle_auto.util.TimeUtil

import java.io.Serializable

/**
 * Created by chenqi on 8/10/17.
 * 记录是否通过检查
 */

class AdioCheckBean : Serializable {
    var isScr = false
    var isOa = false
    var isTouch = false
    var isSn_up = false
    var isSn_down = false


    var showResultBean: String? = null
    var serialPortOtherBean: String? = null

    var scr_text = "没有值"//实际数值
    var inr_text = "没有值"//实际数值
    var plate_inr_text = "没有值"//实际数值
    var oa_text = "没有值"//实际数值
    var touch_text = "没有值"//实际数值
    var sn_up_text = "没有值"//实际数值
    var sn_down_text = "没有值"//实际数值


    private val PASS = "通过"
    private val NO_PASS = "未通过，请检查！"

    val scr_: String
        get() = if (isScr) {
            PASS
        } else
            NO_PASS

    val oa_: String
        get() = if (!oa_text.equals("没有值", ignoreCase = true)) {
            if (Integer.valueOf(oa_text) in 15..45) {
                PASS
            } else
                NO_PASS
        } else
            NO_PASS

    val touch_: String
        get() = if (isTouch) {
            PASS
        } else
            NO_PASS

    val sn_up_: String
        get() = if (isSn_up) {
            PASS
        } else
            NO_PASS

    val sn_down_: String
        get() = if (isSn_down) {
            PASS
        } else
            NO_PASS


    override fun toString(): String {
        return "\r\n" + "打印时间：" + TimeUtil.currenTime +
                "\r\n" + "摸手：" + "\r\n" + "值：" + touch_text + "\r\n" + touch_ + "\r\n" +
                "\r\n" + "上身板SN：" + "\r\n" + "值：" + sn_up_text + ":" + sn_up_ + "\r\n" +
                "\r\n" + "下身板SN：" + "\r\n" + "值：" + sn_down_text + "：" + sn_down_ + "\r\n" +
                "\r\n" + "下视红外：" + "\r\n" + showResultBean +
                "\r\n" + "急停和超声：" + "\r\n" + serialPortOtherBean +
                "备注：" + "上面是根据实时测试得来的数据！需要在已定的测试环境下测试！" + "\r\n"
    }

    companion object {
        private const val serialVersionUID = 1L//默认序列号
    }
}
